package mysql

import "gorm.io/gorm"

type Order struct {
	gorm.Model
	UserId      int     `gorm:"type:int;not null;comment:'用户Id'"`
	GoodId      int     `gorm:"type:int;not null;comment:'商品Id'"`
	OrderSn     string  `gorm:"type:char(36);not null;comment:'订单号'"`
	Amount      float64 `gorm:"type:double(10,2);not null;comment:'总价'"`
	GoodTitle   string  `gorm:"type:varchar(50);not null;comment:'商品标题'"`
	GoodImage   string  `gorm:"type:varchar(255);not null;comment:'图片'"`
	OrderStatus int     `gorm:"type:int;not null;comment:订单状态:1-已支付,2-未支付,3-待支付,4-已完成"`
	Payment     int     `gorm:"type:int;not null;comment:支付类型:1-微信,2-支付宝"`
}

func (o *Order) Create() error {
	return DB.Create(&o).Error
}
